package com.csun.cmny.provider.model.service;

import com.csun.cmny.provider.model.dto.volunteer.VolunteerQueryDto;
import com.csun.cmny.provider.model.service.hystrix.UacMqMessageApiHystrix;
import com.csun.cmny.provider.model.service.hystrix.UacUserTokenFeignApiHystrix;
import com.csun.cmny.provider.model.service.hystrix.UacVolunteerFeignApiHyxtrix;
import com.csun.cmny.provider.model.vo.VolunteerVo;
import com.csun.cmny.security.feign.OAuth2FeignAutoConfiguration;
import com.csun.cmny.util.wrapper.Wrapper;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-05-27 09:57
 * @Description:
 */
@FeignClient(value = "cmny-provider-uac", configuration = OAuth2FeignAutoConfiguration.class, fallback = UacVolunteerFeignApiHyxtrix.class)
public interface UacVolunteerFeignApi {

    /**
     * 获取志愿者信息
     *
     * @param volunteerId   志愿者Id
     *
     * @return  志愿者信息
     */
    @PostMapping("/api/uac/volunteer/getVolunteerByVolunteerId")
    Wrapper<VolunteerVo> getVolunteerByVolunteerId(@RequestParam("volunteerId") Long volunteerId);

    /**
     * 更新志愿者积分
     *
     * @param volunteerId 志愿者Id
     * @param integral    积分
     *
     * @return the int.
     */
    @PostMapping("/api/uac/volunteer/updateVolunteerIntegralByVolunteerId")
    Wrapper<Integer> updateVolunteerIntegralByVolunteerId(@RequestParam("volunteerId") Long volunteerId,
                                                          @RequestParam("integral") Integer integral);

    /**
     * 查询志愿者列表
     *
     * @param volunteerQueryDto volunteer query dto
     * @return the list.
     */
    @PostMapping("/api/uac/volunteer/queryVolunteerListWithPage")
    Wrapper<List<VolunteerVo>> queryVolunteerListWithPage(@RequestBody VolunteerQueryDto volunteerQueryDto);

    /**
     * 根据志愿者Id集合查询志愿者列表
     *
     * @param volunteerIdList volunteer id list
     * @return the list.
     */
    @PostMapping("/api/uac/volunteer/queryVolunteerListByVolunteerIds")
    Wrapper<List<VolunteerVo>> queryVolunteerListByVolunteerIds(@RequestBody List<Long> volunteerIdList);

    /**
     * 根据用户Id查询志愿者信息
     *
     * @param userId
     * @return
     */
    @PostMapping("/api/uac/volunteer/getVolunteerByUserId")
    Wrapper<VolunteerVo> getVolunteerByUserId(@RequestParam("userId") Long userId);

    /**
     * 大数据平台查询
     *
     * @param groupId
     * @return
     */
    @PostMapping("/api/uac/volunteer/selectVolunteerCount")
    Wrapper<Integer> selectVolunteerCount(@RequestParam("groupId") Long groupId);
}
